package com.freedom.start.modules.act.controller;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: zhenggang.liu
 * @Date: 2019/12/23 13:31
 */
@RestController
@RequestMapping("/activiti")
public class ActivitiController {

    @Resource
    RepositoryService repositoryService;
    @Resource
    ProcessEngine processEngine;

    @RequestMapping("/getProcessDef")
    public String getProcessDef(){
        List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
        for (ProcessDefinition processDefinition : list) {

            System.out.println(processDefinition.getKey()+" : "+processDefinition.getName());
        }

        return "success";
    }
}
